package com.legendshop.openportal.sdk.model.request.v4;

import cn.hutool.core.util.StrUtil;
import com.legendshop.openportal.sdk.model.PageRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotNull;
import java.beans.Transient;

import static com.legendshop.openportal.sdk.model.constants.ApiPathConstantsV4.AFS_INFO_V4;

/**
 * @author jzh
 * @version 1.0.0
 * @title AfterSaleInfoRequest
 * @date 2024/6/29 17:41
 * @description：售后信息查询
 */
@Data
public class AfterSaleInfoV4Request extends PageRequest {

    private static final long serialVersionUID = 2893713228682975202L;

    /**
     * 店铺id
     */
    @NotNull(message = "店铺id不能为空")
    @ApiModelProperty("店铺id")
    private Long shopId;

    /**
     * 订单号(下单返回的父订单号，或者支付后拆单的子单号。如果已拆单，则只能传子单号过来)
     * （与售后单号二选一）
     */
    @ApiModelProperty("订单号")
    private String subNumber;

    /**
     * 售后单号（与订单号二选一）
     * 如果为空，则返回订单号下的所有售后单
     * 如果不为空，则返回订单号下的指定售后单
     */
    @ApiModelProperty(value = "售后单号", required = true)
    private String refundSn;

    /**
     * 非空：否
     *
     * 扩展参数。支持多个状态组合查询[英文逗号间隔]
     * refundType 售后退款类型
     */
    private String queryExts;

    /**
     * 检查返货地址
     *
     * @return
     */
    @Transient
    @AssertTrue(message = "订单号或者售后单号不能为空")
    public Boolean getCheckParam() {
        return StrUtil.isNotBlank(subNumber) || StrUtil.isNotBlank(refundSn);
    }

    @Override
    @ApiModelProperty(hidden = true)
    public String getApiPath() {
        return AFS_INFO_V4;
    }
}
